
/* Note  definitions for labeled variables are giving in section 6 of main text of paper*/

use huber_ting_replicate, replace

* Summary statistics and correlations using largest number of observations
 reg Hiring clientelism1  , robust
predict x1 if e(sample)
reg Hiring PVP
predict x2 if e(sample)
label var Hiring "{\sc hiring}" 
label var gdpmean "{\sc gdp/capita(log)}" 
label var  PVPmean "{\sc pvp}"  
label var  clientelism1 "{\sc clientelism}" 
label var  clientelism2 "{\sc clientelism2}"  
label var  EP_ethnic "{\sc ethnic polarization}" 
label var  prmean "{\sc pr}" 
label var  presmean "{\sc presidential}" 
label var  EAsia "{\sc east asia}" 
label var  CenEurope "{\sc central europe}" 
label var  LatinAm "{\sc latin america}" 
label var  SAsia "{\sc south asia}" 
label var Africa "{\sc africa}" 
label var  MidEast "{\sc mideast}"  
label var  first_client1 "{\sc clientelism(1st)}" 
label var  second_client1 "{\sc clientelism(2d)}" 
label var  first_client2 "{\sc clientelism2(1st)}"
label var  second_client2 "{\sc clientelism2(2d)}" 
label var first_size "{\sc size(1st)}" 
label var second_size  "{\sc size(2d)}" 
label var NeoEur "{\sc neoeurope}" 


* Create Table 2 (in appendix)				
set more off
estpost sum Hiring PVPmean clientelism1 clientelism2 first_size second_size first_client1 second_client1 first_client2 second_client2 gdpmean EP_e presmean prmean  CenEurope  ///
LatinAm MidEast Africa  EAsia SAsia NeoEur if x1~=. | x2~=.
est store A
esttab A using summary.tex, replace   nonumber nomtitle  cell("count mean(fmt(3)) sd(fmt(3))") ///
		legend label collabels(none) varlabels(_cons "{\sc constant}"  gdpmean "{\sc gdp/capita(log)}" PVPmean "{\sc pvp}"   ///
				clientelism1 "{\sc clientelism}" clientelism2 "{\sc clientelism2}"  EP_ethnic "{\sc ethnic polarization}" prmean "{\sc pr}" presmean "{\sc presidential}" EAsia "{\sc east asia}"  ///
			  CenEurope "{\sc central europe}" LatinAm "{\sc latin america}" SAsia "{\sc south asia}" Africa "{\sc africa}" MidEast "{\sc mideast}" /// 
			   first_client1 "{\sc clientelism(1st)}" second_client1 "{\sc clientelism(2d)}" first_client2 "{\sc clientelism2(1st)}" /// 
			    second_client2 "{\sc clientelism2(2d)}" first_size "{\sc size(1st)}" second_size  "{\sc size(2d)}" NeoEur "{\sc neoeurope}" )


/* Create Table 3 in appendix */
				
* Correlation matrix of main variables
 corrtex Hiring PVPmean clientelism1 clientelism2 first_client1 second_client1 first_client2 second_client2 gdpmean ///
  EP_e presmean prmean if x1~=. | x2~=., file(correlations) replace case sig dig(3) nb  ///
  

* Create left figure in Figure 6  			  

 twoway(scatter Hiring PVPmean, xtitle(PVP) scheme(s2mono) ml(ccodealp))
graph export pvp.pdf, replace

 
* Create right figure in Figuew 6
 twoway(scatter Hiring clientelism1, xtitle(Clientelism) scheme(s2mono) ml(ccodealp))
graph export clientelism.pdf, replace


 * Create Table 1 in main text
* Model 1
reg Hiring PVPmean  , robust
est sto b1
 
*  Model 2
 reg Hiring PVPmean CenEurope  LatinAm MidEast Africa  EAsia SAsia  , robust
 est sto b2

  * Get the substantive size
 reg Hiring PVPmean CenEurope  LatinAm MidEast Africa  EAsia SAsia  , beta

 
 * Model 3
 reg Hiring PVPmean  presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia , robust
est sto b3


 * Clientelism

 
 * Model 4
 reg Hiring clientelism1  , robust
 est sto b4

 * Model 5
 reg Hiring clientelism1 CenEurope  LatinAm MidEast Africa  EAsia SAsia  , robust
 est sto b5

  * Get the substantive size
 reg Hiring clientelism1 CenEurope  LatinAm MidEast Africa  EAsia SAsia  , beta

 
 * Model 6
 reg Hiring clientelism1  presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia  , robust
est sto b6

 * get substantive size
 reg Hiring clientelism1  presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia  , beta
  

 * Model 7
 reg Hiring first_client1 second_client1 presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia   , robust
 est sto b7


 
	 
	 
	estout b1 b2 b3 b4 b5 b6 b7  using table.tex ,  replace cells(b(star fmt(3)) p(par fmt(3)))  style(tex)  ///
					 stats(r2 N, fmt(%9.3f %9.0g) labels("R-squared" N))  order(PVPmean clientelism1 first_client1 second_client1)    ///
				legend label collabels(none) varlabels(_cons "{\sc constant}"  gdpmean "{\sc gdp/capita(log)}" PVPmean "{\sc pvp}"   ///
				clientelism1 "{\sc clientelism}" clientelism2 "{\sc clientelism2}"  EP_ethnic "{\sc ethnic polarization}" prmean "{\sc pr}" presmean "{\sc presidential}" EAsia "{\sc east asia}"  ///
			  CenEurope "{\sc central europe}" LatinAm "{\sc latin america}" SAsia "{\sc south asia}" Africa "{\sc africa}" MidEast "{\sc mideast}" /// 
			   first_client1 "{\sc clientelism(1st)}" second_client1 "{\sc clientelism(2d)}" first_client2 "{\sc clientelism2(1st)}" /// 
			    second_client2 "{\sc clientelism2(2d)}" first_size "{\sc size(1st)}" second_size  "{\sc size(2d)}" )

				
				
				
* Create Table 4 in Appendix
 reg Hiring clientelism2, robust
 est sto c1
 reg Hiring clientelism2 CenEurope  LatinAm MidEast Africa  EAsia SAsia  , robust
 est sto c2
 reg Hiring clientelism2  presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia  , robust
 est sto c3
 reg Hiring first_client2 second_client2 presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia   , robust
 est sto c4
  * Add party size controls to models with first_client and second_client
    reg Hiring first_client2 second_client2 first_size second_size presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia   , robust
 est sto c5
  reg Hiring first_client1 second_client1 first_size second_size presmean prmean gdpmean   EP CenEurope  LatinAm MidEast Africa  EAsia SAsia   , robust
est sto c6


	 
	estout c1 c2 c3 c4 c5 c6  using tableappend.tex ,  replace cells(b(star fmt(3)) p(par fmt(3)))  style(tex)  ///
					 stats(r2 N, fmt(%9.3f %9.0g) labels("R-squared" N))  /// 
					 order( clientelism2 first_client2 second_client2 first_client1 second_client1 first_size second_size )    ///
				legend label collabels(none) varlabels(_cons "{\sc constant}"  gdpmean "{\sc gdp/capita(log)}" PVPmean "{\sc pvp}"   ///
				clientelism1 "{\sc clientelism}" clientelism2 "{\sc clientelism2}"  EP_ethnic "{\sc ethnic polarization}" prmean "{\sc pr}" presmean "{\sc presidential}" EAsia "{\sc east asia}"  ///
			  CenEurope "{\sc central europe}" LatinAm "{\sc latin america}" SAsia "{\sc south asia}" Africa "{\sc africa}" MidEast "{\sc mideast}" /// 
			   first_client1 "{\sc clientelism(1st)}" second_client1 "{\sc clientelism(2d)}" first_client2 "{\sc clientelism2(1st)}" /// 
			    second_client2 "{\sc clientelism2(2d)}" first_size "{\sc size(1st)}" second_size  "{\sc size(2d)}" )
